package gh625simpleviewer;

public class TrackLap {

    public Integer Stop = 0;
    public Integer Duration = 0;
    public Integer Distance = 0;
    public Integer MaxHR = 0;
    public Integer AvgHR = 0;
    public Integer Calories = 0;
    public Integer MaxSpeed = 0;
    public Integer Points = 0;

    @Override
    public String toString() {
        Integer starttime = Stop - Duration;
        Integer starttime_h = starttime / 36000;
        Integer starttime_m = (starttime - starttime_h * 36000) / 600;
        Integer starttime_s = (starttime - starttime_h * 36000 - starttime_m * 600) / 10;
        Integer starttime_ms = starttime - starttime_h * 36000 - starttime_m * 600 - starttime_s * 10;
        String s_starttime_h = starttime_h.toString();
        if (s_starttime_h.length() < 2) {
            s_starttime_h = "0" + s_starttime_h;
        }
        String s_starttime_m = starttime_m.toString();
        if (s_starttime_m.length() < 2) {
            s_starttime_m = "0" + s_starttime_m;
        }
        String s_starttime_s = starttime_s.toString();
        if (s_starttime_s.length() < 2) {
            s_starttime_s = "0" + s_starttime_s;
        }
        String s_starttime_ms = starttime_ms.toString() + "00";
        String start = s_starttime_h + ":" + s_starttime_m + ":" + s_starttime_s + "." + s_starttime_ms;

        Integer stoptime = Duration + starttime;
        Integer stoptime_h = stoptime / 36000;
        Integer stoptime_m = (stoptime - stoptime_h * 36000) / 600;
        Integer stoptime_s = (stoptime - stoptime_h * 36000 - stoptime_m * 600) / 10;
        Integer stoptime_ms = stoptime - stoptime_h * 36000 - stoptime_m * 600 - stoptime_s * 10;
        String s_stoptime_h = stoptime_h.toString();
        if (s_stoptime_h.length() < 2) {
            s_stoptime_h = "0" + s_stoptime_h;
        }
        String s_stoptime_m = stoptime_m.toString();
        if (s_stoptime_m.length() < 2) {
            s_stoptime_m = "0" + s_stoptime_m;
        }
        String s_stoptime_s = stoptime_s.toString();
        if (s_stoptime_s.length() < 2) {
            s_stoptime_s = "0" + s_stoptime_s;
        }
        String s_stoptime_ms = stoptime_ms.toString() + "00";
        String stop = s_stoptime_h + ":" + s_stoptime_m + ":" + s_stoptime_s + "." + s_stoptime_ms;

        Integer duratime = Duration;
        Integer duratime_h = duratime / 36000;
        Integer duratime_m = (duratime - duratime_h * 36000) / 600;
        Integer duratime_s = (duratime - duratime_h * 36000 - duratime_m * 600) / 10;
        Integer duratime_ms = duratime - duratime_h * 36000 - duratime_m * 600 - duratime_s * 10;
        String s_duratime_h = duratime_h.toString();
        if (s_duratime_h.length() < 2) {
            s_duratime_h = "0" + s_duratime_h;
        }
        String s_duratime_m = duratime_m.toString();
        if (s_duratime_m.length() < 2) {
            s_duratime_m = "0" + s_duratime_m;
        }
        String s_duratime_s = duratime_s.toString();
        if (s_duratime_s.length() < 2) {
            s_duratime_s = "0" + s_duratime_s;
        }
        String s_duratime_ms = duratime_ms.toString() + "00";
        String dura = s_duratime_h + ":" + s_duratime_m + ":" + s_duratime_s + "." + s_duratime_ms;

        return "Lap: " + start + "-" + stop + " (" + dura + ")";
    }
}
